home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / VBASIC / T2WIN-32.ZIP / _REGISTR.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-01-01  |  12.0 KB  |  245 lines

  1. VERSION 4.00
  2. Begin VB.Form frmRegistry 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Registry"
  5.    ClientHeight    =   4845
  6.    ClientLeft      =   1890
  7.    ClientTop       =   3270
  8.    ClientWidth     =   7485
  9.    Height          =   5250
  10.    Left            =   1830
  11.    MaxButton       =   0   'False
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   4845
  14.    ScaleWidth      =   7485
  15.    ShowInTaskbar   =   0   'False
  16.    Top             =   2925
  17.    Width           =   7605
  18.    Begin VB.TextBox txt_Result 
  19.       BackColor       =   &H00C0C0C0&
  20.       BorderStyle     =   0  'None
  21.       Height          =   4110
  22.       Left            =   105
  23.       Locked          =   -1  'True
  24.       MultiLine       =   -1  'True
  25.       ScrollBars      =   2  'Vertical
  26.       TabIndex        =   6
  27.       Top             =   630
  28.       Width           =   7260
  29.    End
  30.    Begin Threed.SSPanel SSPanel1 
  31.       Align           =   1  'Align Top
  32.       Height          =   480
  33.       Left            =   0
  34.       TabIndex        =   0
  35.       Top             =   0
  36.       Width           =   7485
  37.       _Version        =   65536
  38.       _ExtentX        =   13203
  39.       _ExtentY        =   847
  40.       _StockProps     =   15
  41.       ForeColor       =   -2147483640
  42.       BackColor       =   12632256
  43.       Begin VB.ComboBox cmb_Function 
  44.          Height          =   315
  45.          Left            =   1365
  46.          TabIndex        =   1
  47.          Top             =   90
  48.          Width           =   4785
  49.       End
  50.       Begin Threed.SSCommand cmdNP 
  51.          Height          =   300
  52.          Index           =   1
  53.          Left            =   7140
  54.          TabIndex        =   5
  55.          Top             =   90
  56.          Width           =   255
  57.          _Version        =   65536
  58.          _ExtentX        =   450
  59.          _ExtentY        =   529
  60.          _StockProps     =   78
  61.          Caption         =   ">"
  62.          BevelWidth      =   1
  63.          Font3D          =   3
  64.          RoundedCorners  =   0   'False
  65.          Outline         =   0   'False
  66.       End
  67.       Begin Threed.SSCommand cmdNP 
  68.          Height          =   300
  69.          Index           =   0
  70.          Left            =   6300
  71.          TabIndex        =   4
  72.          Top             =   90
  73.          Width           =   255
  74.          _Version        =   65536
  75.          _ExtentX        =   450
  76.          _ExtentY        =   529
  77.          _StockProps     =   78
  78.          Caption         =   "<"
  79.          BevelWidth      =   1
  80.          Font3D          =   3
  81.          RoundedCorners  =   0   'False
  82.          Outline         =   0   'False
  83.       End
  84.       Begin VB.Label Label2 
  85.          Caption         =   "&Select a function"
  86.          Height          =   255
  87.          Left            =   90
  88.          TabIndex        =   3
  89.          Top             =   120
  90.          Width           =   1275
  91.       End
  92.       Begin Threed.SSCommand SSCommand1 
  93.          Default         =   -1  'True
  94.          Height          =   300
  95.          Left            =   6615
  96.          TabIndex        =   2
  97.          Top             =   90
  98.          Width           =   465
  99.          _Version        =   65536
  100.          _ExtentX        =   820
  101.          _ExtentY        =   529
  102.          _StockProps     =   78
  103.          Caption         =   "&Go"
  104.          BevelWidth      =   1
  105.          RoundedCorners  =   0   'False
  106.          Outline         =   0   'False
  107.       End
  108.    End
  109. Attribute VB_Name = "frmRegistry"
  110. Attribute VB_Creatable = False
  111. Attribute VB_Exposed = False
  112. Option Explicit
  113. Option Base 1
  114. Private Const Iteration = 250
  115. Dim IsLoaded         As Integer
  116. Dim TimerStartOk     As Integer
  117. Dim TimerCloseOk     As Integer
  118. Dim TimerHandle      As Integer
  119. Dim TimerValue       As Long
  120. Private Sub cmdNP_Click(Index As Integer)
  121.    Call sub_NextPrev(cmb_Function, Index)
  122. End Sub
  123. Private Sub cmb_Function_Click()
  124.    If (IsLoaded = False) Then Exit Sub
  125.    Call cDisableFI(mdiT2W.Picture1)
  126.    txt_Result = ""
  127.    DoEvents
  128.    Select Case cmb_Function.ListIndex
  129.       Case 0
  130.          Call TestRegistry
  131.       Case 1
  132.          Call TestRegistryExt
  133.    End Select
  134.    DoEvents
  135.    Call cEnableFI(mdiT2W.Picture1)
  136. End Sub
  137. Private Sub Form_Activate()
  138.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  139. End Sub
  140. Private Sub Form_Load()
  141.    IsLoaded = False
  142.    Show
  143.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_registr.t2w")
  144.    IsLoaded = True
  145. End Sub
  146. Private Sub SSCommand1_Click()
  147.    Call cmb_Function_Click
  148. End Sub
  149. Private Sub TestRegistry()
  150.    Dim intResult        As Integer
  151.    Dim strResult        As String
  152.    Dim strDisplay       As String
  153.    Dim Section1         As String
  154.    Dim Section2         As String
  155.    Dim i                As Integer
  156.    strResult = ""
  157.    strDisplay = ""
  158.    strDisplay = strDisplay & "HKEY_CURRENT_USER" & vbCrLf & vbCrLf
  159.    Section1 = "under the fox"
  160.    Section2 = "software\The MCR Company\TIME TO WIN for VB 4.0"
  161.    strDisplay = strDisplay & "Use section '" & Section1 & "'" & vbCrLf & vbCrLf
  162.    strDisplay = strDisplay & "Setting default value to 'no key' is '" & cPutRegistry(Section1, "", "no key") & "'" & vbCrLf
  163.    strDisplay = strDisplay & "Setting value of key 'key1' to 'test key 1' is '" & cPutRegistry(Section1, "key1", "test key 1") & "'" & vbCrLf
  164.    strDisplay = strDisplay & "Setting value of key 'key2' to 'test key 2' is '" & cPutRegistry(Section1, "key2", "test key 2") & "'" & vbCrLf & vbCrLf
  165.    strDisplay = strDisplay & "Getting default value is '" & cGetRegistry(Section1, "", "?") & "'" & vbCrLf
  166.    strDisplay = strDisplay & "Getting value of key 'key2' is '" & cGetRegistry(Section1, "key2", "?") & "'" & vbCrLf
  167.    strDisplay = strDisplay & "Getting value of key 'key1' is '" & cGetRegistry(Section1, "key1", "?") & "'" & vbCrLf & vbCrLf
  168.    strDisplay = strDisplay & "Use section '" & Section2 & "'" & vbCrLf & vbCrLf
  169.    strDisplay = strDisplay & "Setting default value to 'License information' is '" & cPutRegistry(Section2, "", "License information") & "'" & vbCrLf
  170.    strDisplay = strDisplay & "Setting value of key 'Name' to 'James' is '" & cPutRegistry(Section2, "Name", "James") & "'" & vbCrLf
  171.    strDisplay = strDisplay & "Setting value of key 'Id' to 'Donb' is '" & cPutRegistry(Section2, "Id", "Donb") & "'" & vbCrLf
  172.    strDisplay = strDisplay & "Setting value of key 'N
  173. ' to '007' is '" & cPutRegistry(Section2, "N
  174. ", "007") & "'" & vbCrLf & vbCrLf
  175.    strDisplay = strDisplay & "Getting default value is '" & cGetRegistry(Section2, "", "?") & "'" & vbCrLf
  176.    strDisplay = strDisplay & "Getting value of key 'Name' is '" & cGetRegistry(Section2, "Name", "?") & "'" & vbCrLf
  177.    strDisplay = strDisplay & "Getting value of key 'Id' is '" & cGetRegistry(Section2, "Id", "?") & "'" & vbCrLf
  178.    strDisplay = strDisplay & "Getting value of key 'N
  179. ' is '" & cGetRegistry(Section2, "N
  180. ", "?") & "'" & vbCrLf & vbCrLf
  181.    strDisplay = strDisplay & "Kill Section 'under the fox' is '" & cKillRegistry(Section1, "") & "'" & vbCrLf & vbCrLf
  182.    strDisplay = strDisplay & "Kill Section 'software\The MCR Company' is '" & cKillRegistry("software\The MCR Company", "") & "'" & vbCrLf & vbCrLf
  183.    strDisplay = strDisplay & "Kill Section 'software\The MCR Company\TIME TO WIN for VB 4.0' is '" & cKillRegistry("software\The MCR Company\TIME TO WIN for VB 4.0", "") & "'" & vbCrLf & vbCrLf
  184.    txt_Result = strDisplay
  185.    'time the function
  186.    intResult = cPutRegistry(Section2, "Name", "James")
  187.    TimerHandle = cTimerOpen()
  188.    TimerStartOk = cTimerStart(TimerHandle)
  189.    For i = 1 To Iteration
  190.       strResult = cGetRegistry(Section2, "", "?1")
  191.    Next i
  192.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  193.    TimerCloseOk = cTimerClose(TimerHandle)
  194.    intResult = cKillRegistry("software\The MCR Company", "")
  195. End Sub
  196. Private Sub TestRegistryExt()
  197.    Dim intResult        As Integer
  198.    Dim strResult        As String
  199.    Dim strDisplay       As String
  200.    Dim Section1         As String
  201.    Dim Section2         As String
  202.    Dim i                As Integer
  203.    strResult = ""
  204.    strDisplay = ""
  205.    strDisplay = strDisplay & "HKEY_LOCAL_MACHINE" & vbCrLf & vbCrLf
  206.    strDisplay = strDisplay & "   (" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, "HARDWARE\DESCRIPTION\System\CentralProcessor\0", "Identifier", "?") & ")" & vbCrLf
  207.    strDisplay = strDisplay & "   (" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, "HARDWARE\DESCRIPTION\System\CentralProcessor\0", "VendorIdentifier", "?") & ")" & vbCrLf & vbCrLf
  208.    Section1 = "under the fox"
  209.    Section2 = "software\The MCR Company\TIME TO WIN for VB 4.0"
  210.    strDisplay = strDisplay & "Use section '" & Section1 & "'" & vbCrLf & vbCrLf
  211.    strDisplay = strDisplay & "Setting default value to 'no key' is '" & cPutRegistryExt(RK_HKEY_LOCAL_MACHINE, Section1, "", "no key") & "'" & vbCrLf
  212.    strDisplay = strDisplay & "Setting value of key 'key1' to 'test key 1' is '" & cPutRegistryExt(RK_HKEY_LOCAL_MACHINE, Section1, "key1", "test key 1") & "'" & vbCrLf
  213.    strDisplay = strDisplay & "Setting value of key 'key2' to 'test key 2' is '" & cPutRegistryExt(RK_HKEY_LOCAL_MACHINE, Section1, "key2", "test key 2") & "'" & vbCrLf & vbCrLf
  214.    strDisplay = strDisplay & "Getting default value is '" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, Section1, "", "?") & "'" & vbCrLf
  215.    strDisplay = strDisplay & "Getting value of key 'key2' is '" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, Section1, "key2", "?") & "'" & vbCrLf
  216.    strDisplay = strDisplay & "Getting value of key 'key1' is '" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, Section1, "key1", "?") & "'" & vbCrLf & vbCrLf
  217.    strDisplay = strDisplay & "Use section '" & Section2 & "'" & vbCrLf & vbCrLf
  218.    strDisplay = strDisplay & "Setting default value to 'License information' is '" & cPutRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "", "License information") & "'" & vbCrLf
  219.    strDisplay = strDisplay & "Setting value of key 'Name' to 'James' is '" & cPutRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "Name", "James") & "'" & vbCrLf
  220.    strDisplay = strDisplay & "Setting value of key 'Id' to 'Donb' is '" & cPutRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "Id", "Donb") & "'" & vbCrLf
  221.    strDisplay = strDisplay & "Setting value of key 'N
  222. ' to '007' is '" & cPutRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "N
  223. ", "007") & "'" & vbCrLf & vbCrLf
  224.    strDisplay = strDisplay & "Getting default value is '" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "", "?") & "'" & vbCrLf
  225.    strDisplay = strDisplay & "Getting value of key 'Name' is '" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "Name", "?") & "'" & vbCrLf
  226.    strDisplay = strDisplay & "Getting value of key 'Id' is '" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "Id", "?") & "'" & vbCrLf
  227.    strDisplay = strDisplay & "Getting value of key 'N
  228. ' is '" & cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "N
  229. ", "?") & "'" & vbCrLf & vbCrLf
  230.    strDisplay = strDisplay & "Kill Section 'under the fox' is '" & cKillRegistryExt(RK_HKEY_LOCAL_MACHINE, Section1, "") & "'" & vbCrLf & vbCrLf
  231.    strDisplay = strDisplay & "Kill Section 'software\The MCR Company' is '" & cKillRegistryExt(RK_HKEY_LOCAL_MACHINE, "software\The MCR Company", "") & "'" & vbCrLf & vbCrLf
  232.    strDisplay = strDisplay & "Kill Section 'software\The MCR Company\TIME TO WIN for VB 4.0' is '" & cKillRegistryExt(RK_HKEY_LOCAL_MACHINE, "software\The MCR Company\TIME TO WIN for VB 4.0", "") & "'" & vbCrLf & vbCrLf
  233.    txt_Result = strDisplay
  234.    'time the function
  235.    intResult = cPutRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "Name", "James")
  236.    TimerHandle = cTimerOpen()
  237.    TimerStartOk = cTimerStart(TimerHandle)
  238.    For i = 1 To Iteration
  239.       strResult = cGetRegistryExt(RK_HKEY_LOCAL_MACHINE, Section2, "", "?1")
  240.    Next i
  241.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  242.    TimerCloseOk = cTimerClose(TimerHandle)
  243.    intResult = cKillRegistryExt(RK_HKEY_LOCAL_MACHINE, "software\The MCR Company", "")
  244. End Sub
  245.